/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Model;

import java.awt.Graphics;
import java.awt.Color;

/**
 *
 * @author Manpreet
 */
public class Car {

    private int carX;
    private int carY;
    private int Height;
    private int Length;
    private Color color;
    private int lane;
    private int num;


    private void init() {
        carX = -50;
        carY = -50;
        Height = 20;
        Length = 20;
        color = color.BLUE;
        lane = 1;
        num = 0;
    }

    /**
     * Returns the number assigned to the car
     * @return
     */
    public int getNum() {
        return num;
    }

    /**
     * Assigned a number to the car using the int num, which is set when the car is spawned,
     * the number is determined by the amount of other cars already created
     * @param num
     */
    public void setNum(int num) {
        this.num = num;
    }

    /**
     * returns the color of the car
     * @return
     */
    public Color getColor() {
        return color;
    }

    /**
     * set the color of the car using Color color
     * @param color
     */
    public void setColor(Color color) {
        this.color = color;
    }

    /**
     * returns the height of the car
     * @return
     */
    public int getHeight() {
        return Height;
    }

    /**
     * Sets the height of the car, using int Height
     * @param Height
     */
    public void setHeight(int Height) {
        this.Height = Height;
    }

    /**
     * Returns the Length of the car
     * @return
     */
    public int getLength() {
        return Length;
    }

    /**
     * Sets the Length of the car, using int Length
     * @param Length
     */
    public void setLength(int Length) {
        this.Length = Length;
    }

    @Override
    public String toString() {
        return "Car{" + "carX=" + carX + "carY=" + carY + '}';
    }

    /**
     * increases the Cars carX value, with int x
     * @param x
     */
    public void moveX(int x) {
        this.carX = carX + x;
    }

    /**
     * increases the Cars carY value, with int y
     * @param y
     */
    public void moveY(int y) {
        this.carY = carY + y;
    }

    /**
     * returns the carX value
     * @return
     */
    public int getCarX() {
        return carX;
    }

    /**
     *  returns the lane value
     * @return
     */
    public int getLane() {
        return lane;
    }

    /**
     * Sets the lane value with int lane, which is used to determine which lane the car is created in
     * @param lane
     */
    public void setLane(int lane) {
        this.lane = lane;
    }

    /**
     * set the carX value with int carX
     * @param carX
     */
    public void setCarX(int carX) {
        this.carX = carX;
    }

    /**
     * returns the carY value
     * @return
     */
    public int getCarY() {
        return carY;
    }

    /**
     * set the carY value with int carY
     * @param carY
     */
    public void setCarY(int carY) {
        this.carY = carY;
    }

    /**
     *  paints the car to the panel using the values carX, carY, Height, Length and color
     * @param g
     */
    public void draw(Graphics g) {
        g.setColor(color);
        g.fillRect(carX, carY, Height, Length);
    }

    /**
     * initializes the values of the car
     */
    public Car() {
        init();
    }
}
